﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Dto;
using MyMES.IServices.ArrivalNotices;
using MyMES.IServices.Inventorytasksment;
using MyMES.IServices.Productionmaterialsment;
using MyMES.Services.ArrivalNotices;
using VOL.Core.Utilities.Response;
using VOL.Entity.DomainModels;
using VOL.Entity.DomainModels.Core;
using VOL.Entity.DomainModels.Repository;

namespace VOL.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InventorytasksController : ControllerBase
    {
        private readonly IInventorytasksServices _inventorytasksService;
        private readonly IProductionmaterialsServices _productionmaterialsServices;

        public InventorytasksController(IInventorytasksServices inventorytasksService, IProductionmaterialsServices productionmaterialsServices)
        {
            _inventorytasksService = inventorytasksService;
            _productionmaterialsServices=productionmaterialsServices;
        }
        #region 盘点任务
        [HttpGet]
        public async Task<PageGridData<Inventorytasks>> QueryInventorytasks(InventorytasksDTO inventorytasksDTO, int PageIndex, int PageSize)
        {
            return await _inventorytasksService.QueryInventorytasks(inventorytasksDTO, PageIndex, PageSize);
        }
        [HttpGet]
        public async Task<PageGridData<Inventorytasks>> InventorytasksList(GetInventorytasksDTO inventorytasksDTO, int PageIndex, int PageSize)
        {
            return await _inventorytasksService.InventorytasksList(inventorytasksDTO, PageIndex, PageSize);
        }
       
        [HttpPost]
        public async Task<int> CreateInventorytasks([FromBody]Inventorytasks inventorytasks)
        {
            return await _inventorytasksService.CreateInventorytasks(inventorytasks);
        }
        [HttpPost]
        public async Task<WebResponseContent> DelInventorytasks(string ids)
        {
            return await _inventorytasksService.DelInventorytasks(ids);
        }
        #endregion

        #region 生产退料
        [HttpGet]
        public async Task<PageGridData<Productionmaterials>> QueryProductionmaterials(ProductionmaterialsDTO productionmaterialsDTO, int PageIndex, int PageSize)
        {
            return await _productionmaterialsServices.QueryProductionmaterials(productionmaterialsDTO, PageIndex, PageSize);
        }
        [HttpGet]
        public async Task<PageGridData<Workorder>> QueryWorkorder(WorkorderDTO workorderDTO, int PageIndex, int PageSize)
        {
            return await _productionmaterialsServices.QueryWorkorder(workorderDTO, PageIndex, PageSize);
        }
        [HttpPost]
        public async Task<int> CreateProductionmaterials([FromBody]Productionmaterials productionmaterials)
        {
            return await _productionmaterialsServices.CreateProductionmaterials(productionmaterials);
        }

        [HttpPost]
        public async Task<int> UpdProductionmaterials([FromBody] Productionmaterials productionmaterials)
        {
            return await _productionmaterialsServices.UpdProductionmaterials(productionmaterials);
        }
        #endregion





    }
}
